
create database REM_db
go
use REM_db
go
create table LoaiSanPham(
	Id int identity primary key,
	TenNhomSanPham Nvarchar(256),
	IdCha int default 0,
	ThuTu int default 1,
	TrangThai tinyint default 1
)
go
insert into LoaiSanPham(TenNhomSanPham, ThuTu) values(N'L1',1)
insert into LoaiSanPham(TenNhomSanPham, ThuTu) values(N'L2',1)
go
create table SanPham(
	Id int identity primary key,
	TenSanPham Nvarchar(256),
	MoTa Nvarchar(1024),
	NoiDung Nvarchar(max),
	GiaBan int,
	GiaKM int,
	ThuTu int default 1,
	Image varchar(128),
	
	Image1 varchar(128),
	Image2 varchar(128),
	Image3 varchar(128),
	Image4 varchar(128),
	
	Keywords Nvarchar(300),
	Description Nvarchar(300),
	Title Nvarchar(300),
	
	NguoiTao int,
	NgayTao datetime default getdate(),
	NguoiSua int,
	NgaySua datetime default getdate(),
	
	TrangThai tinyint default 1,
	LoaiSanPhamId int
)

create table Users(
	Id int identity primary key,
	UserName varchar(64),
	Pass varchar(64),
	TrangThai tinyint default 1
)